package com.xw.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * service方法和doGet方法和doPost方法的区别
 * 		service:可以处理get和post方法，当servlet中有service方法时，优先调用service方法
 * 		doGet:可以处理get方式的请求
 * 		doPost:可以出post方式的请求
 * @author Administrator
 *
 */
public class ServletMethod extends HttpServlet{

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		System.out.println("我是service");
	}
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		System.out.println("我是 doGet");
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		System.out.println("我是doPost");
	}
}
